package com.terrace.db.quartz.service;

import org.quartz.SchedulerException;

import com.terrace.db.quartz.mapper.entity.SchedulerJob;
import com.terrace.core.mybatis.entity.Pagination;

/**
 * 任务调度器Service
 * 
 * @author jiangyg
 *
 */
public interface QuartzService {

	/**
	 * 新增调度任务
	 * 
	 * @param job
	 */
	public void addSchedulerJob(SchedulerJob job) throws Exception;

	/**
	 * 删除调度任务
	 * 
	 * @param job
	 */
	public void deleteSchedulerJob(SchedulerJob job) throws Exception;

	/**
	 * 修改调度任务
	 * 
	 * @param job
	 */
	public void updateSchedulerJob(SchedulerJob job) throws Exception;

	/**
	 * 暂停调度任务
	 * @param job
	 * @throws Exception
	 */
	public void pauseSchedulerJob(SchedulerJob job) throws Exception;
	
	/**
	 * 立刻执行调度任务
	 * @param job
	 * @throws Exception
	 */
	public void immediatelyExecuteSchedulerJob(SchedulerJob job) throws Exception;
	
	/**
	 * 恢复调度任务
	 * @param job
	 * @throws Exception
	 */
	public void resumeSchedulerJob(SchedulerJob job) throws Exception;
	
	/**
	 * 查询任务是否存在
	 * @param job
	 * @return
	 * @throws SchedulerException
	 */
	public boolean checkSchedulerExists(SchedulerJob job) throws SchedulerException;
	
	/**
	 * 根据主键查询任务
	 * @param schedName
	 * @param jobName
	 * @param jobGroup
	 * @return
	 */
	public SchedulerJob selectSchedulerJobByPrimaryKey(String schedName, String jobName, String jobGroup);
	
	/**
	 * 分页查询调度作业
	 * @param pagination
	 * @param job
	 * @return
	 */
	public Pagination<SchedulerJob> selectSchedulerJobForPagination(Pagination<SchedulerJob> pagination, SchedulerJob job);

}
